package com.zyh.homework.test04;

import java.math.BigDecimal;
import java.util.Random;

public class Test4 {
    public static void main(String[] args) {
        double num = new Random().nextDouble();
        num=num*100;
        String str=num+"";
        System.out.println("随机数为：\n"+str);
        BigDecimal big = new BigDecimal(str);
        BigDecimal divide = big.divide(new BigDecimal("1"), 2, BigDecimal.ROUND_DOWN);
        System.out.println("转换为： \n"+divide);

    }
}
